import { _decorator, Component } from 'cc';
import { DataItemLayout } from '../../../Core/DataItemLayout';
const { ccclass, property } = _decorator;

/**
 * 248139929
 * Mon Apr 22 2024 18:31:36 GMT+0800 (中国标准时间)
 */

function getMinMax(min:number, max:number){
    return Math.floor(Math.random() * (max - min + 1)) + min;
}

@ccclass('ArenaPanel')
export class ArenaPanel extends Component {

    @property(DataItemLayout)
    rankDatas:DataItemLayout

    protected onLoad(): void {
        
        let datas:{name:string, score:number, sols:{icon:number, quality:number}[]}[] = []
        for (let i = 0; i < 99; i++) {
            let d = {name:`玩家${i}`, score:1000 - i, sols:[]}
            let sc = getMinMax(1, 10)
            for (let j = 0; j < sc; j++) {
                d.sols.push({icon:getMinMax(1, 5), quality:getMinMax(1, 5)})
            }
            datas.push(d)
        }

        this.rankDatas.bindDatas(datas)
    }
}
